import { defineConfig } from '@rsbuild/core';
import { pluginDts } from 'rsbuild-plugin-dts';
import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin';
import { DotenvRunPlugin } from '@dotenv-run/rspack';
export default defineConfig({
  plugins: [
    // pluginDts({
    //   banner: '// @ts-nocheck',
    //   build: true,
    //   distPath: 'dist',
    // }),
  ],
  source: {
    entry: {
      // index: './src/index.ts',
    },
  },
  html: {
    template: './index.html',
  },
  server: {
    port: 9380,
  },
  tools: {
    rspack(config, { appendPlugins }) {
      appendPlugins(
        new DotenvRunPlugin({
          verbose: true,
        }),
      );
      // Only register the plugin when RSDOCTOR is true, as the plugin will increase the build time.
      if (process.env.RSDOCTOR) {
        appendPlugins(
          new RsdoctorRspackPlugin({
            linter: {
              rules:{
                "ecma-version-check": "off"
              }
            },
          }),
        );
      }
    },
  },
});
